﻿CREATE PROCEDURE [dbo].[GetUsefulInfo]
AS
BEGIN
 -- SET NOCOUNT ON added to prevent extra result sets from
 -- interfering with SELECT statements.
 SET NOCOUNT ON;

    -- Insert statements for procedure here
SELECT a.InfoId
      ,a.Title
      ,a.Source
      ,a.Details
      ,a.CreateDate
      ,a.UpdateDate
      ,a.StatusDelete
,max(d.SmallUrl) as PropertyURL
  FROM Mobile_UsefulInfo a
  left join AW_Picture d on d.PropertyId = a.InfoId
 where a.StatusDelete is null or a.StatusDelete=0
group by a.InfoId
      ,a.Title
      ,a.Source
      ,a.Details
      ,a.CreateDate
      ,a.UpdateDate
      ,a.StatusDelete
  order by a.UpdateDate desc
END
